package com.suixinsanren.design.compound.demo01;

public class QuackCounter implements QuackAble {

    private final QuackAble quackAble;
    private static int quackCounter;

    public QuackCounter(QuackAble quackAble) {
        this.quackAble = quackAble;
    }

    @Override
    public void quack() {
        quackAble.quack();
        quackCounter++;
    }

    public static int getQuackCounter() {
        return quackCounter;
    }

    @Override
    public void registerObserver(Observer observer) {
        quackAble.registerObserver(observer);
    }

    @Override
    public void notifyObservers() {
        quackAble.notifyObservers();
    }
}
